using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using System.IO;

namespace AndroidClient
{
	[Activity (Label = "Display")]			
	public class Display : Activity
	{
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			FullScreen();
			SetContentView (Resource.Layout.Display);
			
			var imageView = FindViewById<ImageView> (Resource.Id.imageView);
			imageView.SetScaleType(ImageView.ScaleType.FitXy);
			
			//ImageSwitcher switcher= FindViewById<ImageSwitcher> (Resource.Id.switcher);
			foreach(string strFile in Directory.GetFiles(Config.savePath))
			{
				Android.Net.Uri uri = Android.Net.Uri.Parse(strFile);
	       	    imageView.SetImageURI(uri);
			}
			//switcher.SetFactory(this);

			//设置动画效果
			//switcher.SetInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
			//switcher.SetOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
		}
		
		public override bool OnCreateOptionsMenu (IMenu menu)
		{
			base.OnCreateOptionsMenu (menu);
			MenuInflater inflater = this.MenuInflater;
			inflater.Inflate(Resource.Layout.DisplayMenu, menu);  
			return true;
		}
		
		public override bool OnOptionsItemSelected (IMenuItem item)
		{
			switch (item.ItemId) 
			{
				case Resource.Id.settings:  
					//startActivity(new Intent(this, Settings.class));  
					return true;
				case Resource.Id.mode1:
					return true;
				case Resource.Id.exit:
					Finish ();
					return true;
				default:
					return false;
			} 
			//return base.OnOptionsItemSelected (item);
		}
		
		protected void FullScreen()
		{
			//设置无标题  
        	RequestWindowFeature(WindowFeatures.NoTitle);  
        	//设置全屏  
        	Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); 
		}
	}
}

